package cn.tedu.myback.converter;

import cn.tedu.myback.pojo.param.UserParam;
import cn.tedu.myback.pojo.po.User;
import cn.tedu.myback.pojo.vo.UserVo;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Configuration;

@Configuration
public class UserConverter {

    public User convertParamToModel(UserParam source) {
        if (source == null) {
            return null;
        }
        User target = new User();
        BeanUtils.copyProperties(source,target);
        return target;
    }

    public UserVo convertModelToVo(User source) {
        if (source == null) {
            return null;
        }
        UserVo target = new UserVo();
        BeanUtils.copyProperties(source,target);
        return target;
    }

}
